#pragma once

#include <string>
#include <vector>
#include <map>

class OFConfigFile;

class PrinterCfg
{
public:
	PrinterCfg(const char *config_file = nullptr);
	~PrinterCfg(void);

	struct DcmPrinter {
		DcmPrinter()
		{
			Type = "PRINTER";
			BorderDensity = "150\\20\\BLACK\\WHITE";
			DisableNewVRs = false;
			DisplayFormat = "1,1\\1,2\\2,1\\2,2\\2,3\\3,3\\3,4\\3,5\\4,4\\4,5";
			EmptyImageDensity = "20\\BLACK\\WHITE";
			FilmDestination = "MAGAZINE\\PROCESSOR\\BIN_1\\BIN_2";
			FilmSizeID = "";
			ImplicitOnly = false;
			MagnificationType = "REPLICATE\\BILINEAR\\CUBIC";
			MaxDensity = "320";
			MaxPDU = "32768";
			MediumType = "PAPER\\CLEAR FILM\\BLUE FILM";
			MinDensity = "20";
			OmitSOPClassUIDFromCreateResponse = false;
			PresentationLUTMatchRequired = false;
			PresentationLUTinFilmSession = false;
			ResolutionID = "STANDARD\\HIGH";
			SmoothingType = "NONE";
			Supports12Bit = true;
			SupportsDecimateCrop = true;
			SupportsImageSize = true;
			SupportsPresentationLUT = true;
			SupportsTrim = true;
		}
		std::string PrinterName;
		std::string Aetitle;
		std::string Description;
		std::string Hostname;
		std::string Port;
		std::string Type;
		std::string BorderDensity;
		bool		DisableNewVRs;
		std::string DisplayFormat;
		std::string EmptyImageDensity;
		std::string FilmDestination;
		std::string FilmSizeID;
		bool        ImplicitOnly;
		std::string MagnificationType;
		std::string MaxDensity;
		std::string MaxPDU;
		std::string MediumType;
		std::string MinDensity;
		bool        OmitSOPClassUIDFromCreateResponse;
		bool        PresentationLUTMatchRequired;
		bool		PresentationLUTinFilmSession;
		std::string ResolutionID;
		std::string SmoothingType;
		bool		Supports12Bit;
		bool		SupportsDecimateCrop;
		bool		SupportsImageSize;
		bool		SupportsPresentationLUT;
		bool		SupportsTrim;

		bool operator==(const DcmPrinter& val)
		{
			return strcmp(PrinterName.c_str(), val.PrinterName.c_str()) == 0;
		}

		bool operator==(const std::string& val)
		{
			return strcmp(PrinterName.c_str(), val.c_str()) == 0;
		}
	};

	typedef std::vector<DcmPrinter> DcmPrinterVec;
	typedef std::map<std::string, DcmPrinter> DcmPrinterMap;
	int GetNumberOfPrinter();
	int GetPrinters(DcmPrinterVec& printers);
	int GetPrinters(DcmPrinterMap& printers);

private:
	OFConfigFile *m_pConfig;
	const char *getConfigEntry(const char *l2_key, const char *l1_key, const char *l0_key);
	bool getConfigBoolEntry(const char *l2_key, const char *l1_key, const char *l0_key, bool deflt);
};

